<?php
class frm_addLeaderBoard{
	private $args;
	function __construct($arg){
		$this->args = $arg;
	}
	function getPublish(){
		$appid = DataGameManager::getAppID();
		$gameid = 0 + $this->args["game_id"];
		if($gameid > 0){
			$ptn = readPattern($_SESSION[ "service_dir" ]  .'/../Application/' .FunctionApp::getAppDirectory(   $appid   ).'/' .'pattern/' . ('ptn_'.  "frm_addLeaderBoard"  ) .'.php' );
			$ptn_gameinfo = readPattern($_SESSION[ "service_dir" ]  .'/../Application/' .FunctionApp::getAppDirectory(   $appid   ).'/' .'pattern/' . ('ptn_'.  "gameinfo"  ) .'.php' );
			$ptn->appid = $appid;
			$ptn->listgames = '';
			$ptn->gameid = $gameid;
			$games = FunctionGameCenter::getAllGames();
			$id = 1;
			if(is_array($games)){
				foreach($games as $game){
					$ptn_gameinfo->id = $id;
					$ptn_gameinfo->name = $game->getName();
					$ptn_gameinfo->description = $game->getInfomation();
					$ptn->listgames .=  $ptn_gameinfo ->publish() ;
					$id++;
				}
			}
			return  $ptn ->publish() ;
		}else{
			{Error::getInstance() ->addError( 0 , "game id invalid" );} ;
		}		
	}
}
?>